#!/bin/bash
#
#make TYPE=TSN_SIM 表示对tsn仿真应用场景进行编译
#make TYPE=TSN_FPGA 表示对tsn FPGA应用场景进行编译


CC = gcc -g
AR = ar

LDHDPATH =-lm -I ./complib/libsim/include -I ./complib/libtsmp/include 
LDLIBS =  -I ./complib/cjson/ -L ./complib/cjson -lcjson

LDLIBS1  = -L ./complib/libsim/ -lsim
LDLIBS2  = -L ./complib/libtsmp/ -ltsmp 


LIBTSMPSRC=./complib/libtsmp/src/


TSMPAPI = ./complib/libtsmp/

INIT_CFG = ./net_init/
STATIC_MAC = ./static_mac/
LEARN_MAC = ./learn_mac/



l2switch: main.c net_init.o static_mac_cfg.o learn_mac_cfg.o 
	$(CC) -o l2switch main.c $(INIT_CFG)net_init.o $(STATIC_MAC)static_mac_cfg.o $(LEARN_MAC)learn_mac_cfg.o $(LDLIBS) $(TSMPAPI)libtsmp.a $(LDHDPATH) $(LDLIBS1) $(LDLIBS2)


net_init.o:
	$(CC) -o $(INIT_CFG)net_init.o -c $(INIT_CFG)net_init.c $(LDLIBS) $(LDLIBS1) $(LDLIBS2) $(LDHDPATH)
	
static_mac_cfg.o:
	$(CC) -o $(STATIC_MAC)static_mac_cfg.o -c $(STATIC_MAC)static_mac_cfg.c $(LDLIBS) $(LDLIBS1) $(LDLIBS2) $(LDHDPATH)

learn_mac_cfg.o:
	$(CC) -o $(LEARN_MAC)learn_mac_cfg.o -c $(LEARN_MAC)learn_mac_cfg.c $(LDLIBS) $(LDLIBS1) $(LDLIBS2) $(LDHDPATH)

clean:
	rm -rf l2switch $(INIT_CFG)*.o $(STATIC_MAC)*.o $(LEARN_MAC)*.o $(LIBTSMPSRC)*.o  

